package org.magicbox.qjunTPO.service.impl;

import org.magicbox.qjunTPO.common.lang.Result;
import org.magicbox.qjunTPO.entity.User;
import org.magicbox.qjunTPO.mapper.UserMapper;
import org.magicbox.qjunTPO.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 欢迎添加科技实践队粉丝群：690849711
 * @since 2021-11-15
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {


    @Override
    public boolean updateMarkerById(Integer uid, Integer marker) {
        User user =getById(uid);
        if(user.getStuid() == null) return false;
        if((user.getStuid()!=null)&
                (marker==0)) return false;
        return updateById(user.setMarker(marker));
    }

    @Override
    public boolean updateLastUp(User uid) {
        uid.setLastDate(LocalDateTime.now());
        return updateById(uid);
    }
}
